﻿/*
*
*
*   My MSDN Shared Script
*
*
*/

$(function () {

    var $lan = $('#language');
    var $indicator = $lan.children().first();
    var $ul = $lan.children().last();

    var locales = [
                    ["es-ar", "Argentina (Español)"],
                    ["pt-br", "Brasil (Português)"],
                    ["en-ca", "Canada (English)"],
                    ["fr-ca", "Canada (Français)"],
                    ["zh-cn", "中国 (简体中文)"],
                    ["es-co", "Colombia (Español)"],
                    ["de-de", "Deutschland (Deutsch)"],
                    ["es-es", "España (Español)"],
                    ["fr-fr", "France (Français)"],
                    ["en-in", "India (English)"],
                    ["it-it", "Italia (Italiano)"],
                    ["ja-jp", "日本 (日本語)"],
                    ["ko-kr", "한국 (한국어)"],
                    ["es-mx", "México (Español)"],
                    ["es-pe", "Perú (Español)"],
                    ["ru-ru", "Россия (Pусский)"],
                    ["zh-tw", "台灣 (繁體中文)"],
                    ["en-gb", "United Kingdom (English)"],
                    ["en-us", "United States (English)"]
                  ];


    // Language hover
    $lan.hover(
        function () { $ul.slideDown(); },
        function () { $ul.slideUp(); }
    );

    // Language option
    for (var i in locales) {
        $ul.append("<li><a>• " + locales[i][1] + "</a></li>").
            children().
            last().
            data("lcid", locales[i][1]).
            click(function () { $indicator.html($(this).data("lcid")); });
    }

});